package com.accesshollywood.grfxOrdering.core;

import java.util.LinkedHashMap;

import com.accesshollywood.grfxOrdering.basics.Users;
import com.accesshollywood.indexables.User;
import com.accesshollywood.viewFiltering.ViewFilter;

public class CoreViewFilterPreset {
	private User								Owner				= Users.unAssigned;
	private int									idViewFilterList	= -1;
	private String								name				= "";
	private LinkedHashMap<Integer, ViewFilter>	checkedFilters;

	public synchronized User getOwner() {
		return Owner;
	}

	public synchronized void setOwner(User owner) {
		Owner = owner;
	}

	public synchronized int getIdViewFilterList() {
		return idViewFilterList;
	}

	public synchronized void setIdViewFilterList(int idViewFilterList) {
		this.idViewFilterList = idViewFilterList;
	}

	public synchronized String getName() {
		return name;
	}

	public synchronized void setName(String name) {
		this.name = name;
	}

	public synchronized LinkedHashMap<Integer, ViewFilter> getCheckedFilters() {
		return checkedFilters;
	}

	public synchronized void setCheckedFilters(LinkedHashMap<Integer, ViewFilter> checkedFilters) {
		this.checkedFilters = checkedFilters;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((Owner == null) ? 0 : Owner.hashCode());
		result = prime * result + ((checkedFilters == null) ? 0 : checkedFilters.hashCode());
		result = prime * result + idViewFilterList;
		result = prime * result + ((name == null) ? 0 : name.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		CoreViewFilterPreset other = (CoreViewFilterPreset) obj;
		if (Owner == null) {
			if (other.Owner != null)
				return false;
		} else if (!Owner.equals(other.Owner))
			return false;
		if (checkedFilters == null) {
			if (other.checkedFilters != null)
				return false;
		} else if (!checkedFilters.equals(other.checkedFilters))
			return false;
		if (idViewFilterList != other.idViewFilterList)
			return false;
		if (name == null) {
			if (other.name != null)
				return false;
		} else if (!name.equals(other.name))
			return false;
		return true;
	}

}
